package org.zh.entity;


import java.time.Instant;
import java.util.*;

public class ServiceEntity {

    private Integer id;
    private String applicationName;  //  项目名称   spring.application.name=product
    private String applicationBaseUrl; // 项目的根  http 地址
    private Set<String> pubClass = new HashSet<>();   //  项目中所要发布的类名称
    private Set<String> subClass = new HashSet<>();   //  项目中需要订阅的类的功能
    private Map<String, Map<String, MethodBean>> methodsJson = new HashMap<>();  // 中间  json  数据
    private Instant createTime;  //创建时间
    private Instant survivalTime;  // 最后远程通信时间
    //非数据库字段


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }


    public String getApplicationName() {
        return applicationName;
    }

    public void setApplicationName(String applicationName) {
        this.applicationName = applicationName;
    }

    public String getApplicationBaseUrl() {
        return applicationBaseUrl;
    }

    public void setApplicationBaseUrl(String applicationBaseUrl) {
        this.applicationBaseUrl = applicationBaseUrl;
    }

    public Set<String> getPubClass() {
        return pubClass;
    }

    public void setPubClass(Set<String> pubClass) {
        this.pubClass = pubClass;
    }

    public Set<String> getSubClass() {
        return subClass;
    }

    public void setSubClass(Set<String> subClass) {
        this.subClass = subClass;
    }

    public Map<String, Map<String, MethodBean>> getMethodsJson() {
        return methodsJson;
    }

    public void setMethodsJson(Map<String, Map<String, MethodBean>> methodsJson) {
        this.methodsJson = methodsJson;
    }

    public Instant getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Instant createTime) {
        this.createTime = createTime;
    }

    public Instant getSurvivalTime() {
        return survivalTime;
    }

    public void setSurvivalTime(Instant survivalTime) {
        this.survivalTime = survivalTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ServiceEntity that = (ServiceEntity) o;
        return Objects.equals(id, that.id) && Objects.equals(applicationName, that.applicationName) && Objects.equals(applicationBaseUrl, that.applicationBaseUrl) && Objects.equals(pubClass, that.pubClass) && Objects.equals(subClass, that.subClass) && Objects.equals(methodsJson, that.methodsJson) && Objects.equals(createTime, that.createTime) && Objects.equals(survivalTime, that.survivalTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, applicationName, applicationBaseUrl, pubClass, subClass, methodsJson, createTime, survivalTime);
    }

    @Override
    public String toString() {
        return "ServiceEntity{" +
               "id=" + id +
               ", applicationName='" + applicationName + '\'' +
               ", applicationBaseUrl='" + applicationBaseUrl + '\'' +
               ", pubClass=" + pubClass +
               ", subClass=" + subClass +
               ", methodsJson=" + methodsJson +
               ", createTime=" + createTime +
               ", survivalTime=" + survivalTime +
               '}';
    }
}
